package com.arcvideo.acsplayer.utils;

import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.view.Window;
import android.view.WindowManager;

public class SystemUtil {

	public static void CheckCPUinfo() {
		ProcessBuilder cmd;
		String result = "";

		try {
			String[] args = {"/system/bin/cat", "/proc/cpuinfo"};
			cmd = new ProcessBuilder(args);

			Process process = cmd.start();
			InputStream in = process.getInputStream();
			byte[] re = new byte[1024];
			while (in.read(re) != -1) {
				System.out.println(new String(re));
				result = result + new String(re);
			}
			in.close();
		} catch (IOException ex) {
			ex.printStackTrace();
		}
		return;
	}

	public static void controlBackLight(Activity activity, boolean flag) {
		if (null == activity)
			return;

		Window win = activity.getWindow();
		if (flag) {
			win.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		} else {
			win.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		}
	}

}
